﻿from django.conf.urls.defaults import *
from django.contrib import databrowse
# from myapp.models import Announcement, Location

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^Project/', include('Project.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
	# (r'^databrowse/(.*)', databrowse.site.root),
    # (r'^$', 'myapp.views.index'),
    # (r'^search/$', 'myapp.views.search'),
    # (r'^location/(?P<location_slug>[A-Za-z0-9_]+)$', 'myapp.views.location'),
    # (r'^user/(?P<user_name>[A-Za-z0-9_]+)$', 'myapp.views.user'),
    # (r'^accounts/login/$', 'django.contrib.auth.views.login',{'template_name': 'login.html'}),
    # (r'^announcement-add/$', 'myapp.views.announcement_add'),
    # (r'^comment-add/$', 'django.contrib.comments.views.comments.post_comment'),
    # (r'^announcement-vote-add/(?P<announcement_id>[0-9]+)$', 'myapp.views.announcement_vote_add'),
    (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/media/favicon.ico'})
)

# databrowse.site.register(Announcement)
# databrowse.site.register(Location)
#hack for serving static media on dev server
from django.conf import settings
if settings.DEBUG:
    from django.views.static import serve
    _media_url = settings.MEDIA_URL
    if _media_url.startswith('/'):
        _media_url = _media_url[1:]
        urlpatterns += patterns('',(r'^%s(?P<path>.*)$' % _media_url,serve,{'document_root': settings.MEDIA_ROOT}))
    del(_media_url, serve)